/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.iss.examsys.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Quek Ting Hong
 */
@Entity
@Table(name = "question_tag")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "QuestionTag.findAll", query = "SELECT q FROM QuestionTag q"),
    @NamedQuery(name = "QuestionTag.findById", query = "SELECT q FROM QuestionTag q WHERE q.id = :id"),
    @NamedQuery(name = "QuestionTag.findByVersion", query = "SELECT q FROM QuestionTag q WHERE q.version = :version"),
    @NamedQuery(name = "QuestionTag.findByCreatedDate", query = "SELECT q FROM QuestionTag q WHERE q.createdDate = :createdDate"),
    @NamedQuery(name = "QuestionTag.findByCreatedBy", query = "SELECT q FROM QuestionTag q WHERE q.createdBy = :createdBy"),
    @NamedQuery(name = "QuestionTag.findByModifiedDate", query = "SELECT q FROM QuestionTag q WHERE q.modifiedDate = :modifiedDate"),
    @NamedQuery(name = "QuestionTag.findByModifiedBy", query = "SELECT q FROM QuestionTag q WHERE q.modifiedBy = :modifiedBy")})
public class QuestionTag implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Column(name = "VERSION")
    private Integer version;
    @Column(name = "CREATED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdDate;
    @Column(name = "CREATED_BY")
    private BigInteger createdBy;
    @Column(name = "MODIFIED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date modifiedDate;
    @Column(name = "MODIFIED_BY")
    private BigInteger modifiedBy;
    @JoinColumn(name = "TAG_ID", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private SubjectTag tagId;
    @JoinColumn(name = "QUESTION_ID", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Question questionId;

    public QuestionTag() {
    }

    public QuestionTag(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public BigInteger getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(BigInteger createdBy) {
        this.createdBy = createdBy;
    }

    public Date getModifiedDate() {
        return modifiedDate;
    }

    public void setModifiedDate(Date modifiedDate) {
        this.modifiedDate = modifiedDate;
    }

    public BigInteger getModifiedBy() {
        return modifiedBy;
    }

    public void setModifiedBy(BigInteger modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    public SubjectTag getTagId() {
        return tagId;
    }

    public void setTagId(SubjectTag tagId) {
        this.tagId = tagId;
    }

    public Question getQuestionId() {
        return questionId;
    }

    public void setQuestionId(Question questionId) {
        this.questionId = questionId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof QuestionTag)) {
            return false;
        }
        QuestionTag other = (QuestionTag) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.iss.examsys.entity.QuestionTag[ id=" + id + " ]";
    }
    
}
